<%@ page import="support.*, java.util.*, java.sql.*, javax.sql.*" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> 
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>


<bean:define id="degForm" name="DegreeForm"/>

<jsp:include page="header.jsp" />

	<div id="content" class="expand">
		<h2>Graduate Application</h2>

		<p>Verify your application below</p>
		
		<p><bean:write name="StudentsForm" property="firstName" /> <bean:write name="StudentsForm" property="lastName" /></p>
		
		<p>Citizenship: <bean:write name="StudentsForm" property="citizenship" /> <br/>
		Residency: <bean:write name="StudentsForm" property="residency" /></p>
		
		<logic:equal name="StudentsForm" property="residency" value="United States">
			<p>
				<bean:write name="StudentsForm" property="address" />,
				<bean:write name="StudentsForm" property="city" />,
				<bean:write name="StudentsForm" property="state" /> <br/>
				<bean:write name="StudentsForm" property="zipCode" />,
				(<bean:write name="StudentsForm" property="areaCode" />)
				<bean:write name="StudentsForm" property="phone" />
			</p>
		</logic:equal>
		<logic:notEqual name="StudentsForm" property="residency" value="United States">
			<p>
				<bean:write name="StudentsForm" property="address" />,
				<bean:write name="StudentsForm" property="city" />
				<bean:write name="StudentsForm" property="zipCode" />, <br/>
				+<bean:write name="StudentsForm" property="countryCode" />
				<bean:write name="StudentsForm" property="phone" />
			</p>
		</logic:notEqual>
		
		<p>Entered Degrees</p>
				
		<%
		// Write out entered degrees
		forms.DegreeForm degreeFormBean = (forms.DegreeForm) degForm;
		Vector degreeList = degreeFormBean.getDegrees();
		for (int i = 0; i < degreeList.size(); i++) {
			out.print("<p>");
			out.print("Degree " + (i + 1) + " <br/>");
			HashMap currentDegree = (HashMap)degreeList.get(i);
			
			out.print("University: " + currentDegree.get("university") + " <br/>");
			out.print("Discipline: " + currentDegree.get("discipline") + " <br/>");
			out.print("Graduation: " + currentDegree.get("month") + "/" + currentDegree.get("year") + " <br/>");
			out.print("GPA: " + currentDegree.get("gpa") + " <br/>");
			out.print("Title: " + currentDegree.get("title") + " <br/>");
			
			out.print("</p>");
		}
		
		// Save the degree to write into the sql
		session.setAttribute("degreeList", degreeList);
		%>

		<p>Specialization: <bean:write name="StudentsForm" property="specialization" /></p>

		<html:link action="students/verification">
			<html:param name="confirm" value="true" />
			<input type="submit" value="Submit Application"/>
		</html:link> <br/>
		
		<html:link action="students/verification">
			<html:param name="confirm" value="false" />
			<input type="submit" value="Cancel"/>
		</html:link>


</body>
</html>